package com.scott.threadcanReIn;

import java.util.concurrent.TimeUnit;

/**
 * @author Scott 2017/11/27 14:22
 */
public class ThreadReInDemo {

    private int i=0;


    private synchronized  void increase(){
        while (i<10){
            i++;
            System.out.println("当前值为：" + i);
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            increase();
        }
    }

    public static void main(String[] args) {
        ThreadReInDemo threadReInDemo = new ThreadReInDemo();
        threadReInDemo.increase();



    }
}
